.TH "modbusSlave" 3 "Sun Sep 2 2018" "Version 2.0" "liblightmodbus" \" -*- nroff -*-
.ad l
.nh
.SH NAME
modbusSlave \- Represents Modbus slave device's status and configuration\&.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <slave\&.h>\fP
.SS "Data Fields"

.in +1c
.ti -1c
.RI "uint8_t \fBaddress\fP"
.br
.RI "The slave's address\&. "
.ti -1c
.RI "\fBModbusRegisterCallbackFunction\fP \fBregisterCallback\fP"
.br
.RI "The pointer to the user-defined register callback function\&. "
.ti -1c
.RI "void * \fBregisterCallbackContext\fP"
.br
.RI "The user data pointer passed to the callback function each time it's used\&. "
.ti -1c
.RI "uint16_t * \fBregisters\fP"
.br
.RI "Pointer to registers data\&. "
.ti -1c
.RI "uint16_t * \fBinputRegisters\fP"
.br
.RI "Pointer to input registers data\&. "
.ti -1c
.RI "uint8_t * \fBregisterMask\fP"
.br
.RI "Mask for register write protection (each bit corresponds to one register) "
.ti -1c
.RI "uint16_t \fBregisterMaskLength\fP"
.br
.RI "Write protection mask (\fBregisterMask\fP) length in bytes (each byte covers 8 registers) "
.ti -1c
.RI "uint16_t \fBregisterCount\fP"
.br
.RI "Slave's register count\&. "
.ti -1c
.RI "uint16_t \fBinputRegisterCount\fP"
.br
.RI "Slave's input register count\&. "
.ti -1c
.RI "uint8_t * \fBcoils\fP"
.br
.RI "Pointer to coils data\&. "
.ti -1c
.RI "uint8_t * \fBdiscreteInputs\fP"
.br
.RI "Pointer to discrete inputs data\&. "
.ti -1c
.RI "uint8_t * \fBcoilMask\fP"
.br
.RI "Masks for coil write protection (each bit corresponds to one coil) "
.ti -1c
.RI "uint16_t \fBcoilMaskLength\fP"
.br
.RI "Write protection mask (\fBcoilMask\fP) length in bytes (each byte covers 8 coils) "
.ti -1c
.RI "uint16_t \fBcoilCount\fP"
.br
.RI "Slave's coil count\&. "
.ti -1c
.RI "uint16_t \fBdiscreteInputCount\fP"
.br
.RI "Slave's discrete input count\&. "
.ti -1c
.RI "\fBModbusExceptionCode\fP \fBlastException\fP"
.br
.RI "Exception code of the last exception generated by \fBmodbusBuildException\fP\&. "
.ti -1c
.RI "\fBModbusFrameError\fP \fBparseError\fP"
.br
.RI "More specific error code of problem encountered during frame parsing\&. "
.ti -1c
.RI "\fBModbusSlaveUserFunction\fP * \fBuserFunctions\fP"
.br
.RI "A pointer to user defined Modbus functions array\&. "
.ti -1c
.RI "uint16_t \fBuserFunctionCount\fP"
.br
.RI "Number of user-defined Modbus functions /see userFunctions\&. "
.ti -1c
.RI "struct {"
.br
.ti -1c
.RI "   uint8_t \fBframe\fP [LIGHTMODBUS_STATIC_MEM_SLAVE_RESPONSE]"
.br
.RI "Statically allocated memory for the response frame\&. "
.ti -1c
.RI "   uint8_t * \fBframe\fP"
.br
.RI "A pointer to dynamically allocated memory for the response frame\&. "
.ti -1c
.RI "   uint8_t \fBlength\fP"
.br
.RI "Frame length in bytes\&. "
.ti -1c
.RI "} \fBresponse\fP"
.br
.RI "Struct containing slave's response to the master's request\&. "
.ti -1c
.RI "struct {"
.br
.ti -1c
.RI "   uint8_t \fBframe\fP [LIGHTMODBUS_STATIC_MEM_SLAVE_REQUEST]"
.br
.RI "Statically allocated memory for the request frame\&. "
.ti -1c
.RI "   const uint8_t * \fBframe\fP"
.br
.RI "A pointer to dynamically allocated memory for the request frame\&. "
.ti -1c
.RI "   uint8_t \fBlength\fP"
.br
.RI "Frame length in bytes\&. "
.ti -1c
.RI "} \fBrequest\fP"
.br
.RI "Struct containing master's request frame\&. "
.in -1c
.SH "Detailed Description"
.PP 
Represents Modbus slave device's status and configuration\&. 
.SH "Field Documentation"
.PP 
.SS "uint8_t modbusSlave::frame[LIGHTMODBUS_STATIC_MEM_SLAVE_REQUEST]"

.PP
Statically allocated memory for the response frame\&. Statically allocated memory for the request frame\&. 
.SS "\fBModbusExceptionCode\fP modbusSlave::lastException"

.PP
Exception code of the last exception generated by \fBmodbusBuildException\fP\&. 
.PP
\fBSee also:\fP
.RS 4
\fBmodbusBuildException\fP 
.RE
.PP

.SS "\fBModbusFrameError\fP modbusSlave::parseError"

.PP
More specific error code of problem encountered during frame parsing\&. This variable is set up by \fBmodbusBuildExceptionErr\fP function 
.PP
\fBSee also:\fP
.RS 4
\fBmodbusBuildExceptionErr\fP 
.RE
.PP

.SS "\fBModbusRegisterCallbackFunction\fP modbusSlave::registerCallback"

.PP
The pointer to the user-defined register callback function\&. 
.PP
\fBNote:\fP
.RS 4
Requires \fCLIGHTMODBUS_COIL_CALLBACK\fP or \fCLIGHTMODBUS_REGISTER_CALLBACK\fP to be defined 
.RE
.PP

.SS "void* modbusSlave::registerCallbackContext"

.PP
The user data pointer passed to the callback function each time it's used\&. 
.PP
\fBWarning:\fP
.RS 4
This pointer is not managed nor controlled by library\&. So, what you set is what you get\&. 
.RE
.PP

.SS "struct { \&.\&.\&. }   modbusSlave::request"

.PP
Struct containing master's request frame\&. 
.PP
\fBNote:\fP
.RS 4
Declaration of the \fCframe\fP member depends on the library configuration\&. It can be either a statically allocated array or a pointer to dynamically allocated memory\&. The behavior is dependant on definition of the \fCLIGHTMODBUS_STATIC_MEM_SLAVE_REQUEST\fP macro
.RE
.PP
\fBSee also:\fP
.RS 4
\fBDisabling dynamic memory allocation\fP 
.RE
.PP

.SS "struct { \&.\&.\&. }   modbusSlave::response"

.PP
Struct containing slave's response to the master's request\&. 
.PP
\fBNote:\fP
.RS 4
Declaration of the \fCframe\fP member depends on the library configuration\&. It can be either a statically allocated array or a pointer to dynamically allocated memory\&. The behavior is dependant on definition of the \fCLIGHTMODBUS_STATIC_MEM_SLAVE_RESPONSE\fP macro
.RE
.PP
\fBSee also:\fP
.RS 4
\fBDisabling dynamic memory allocation\fP 
.RE
.PP

.SS "\fBModbusSlaveUserFunction\fP* modbusSlave::userFunctions"

.PP
A pointer to user defined Modbus functions array\&. 
.PP
\fBNote:\fP
.RS 4
Requires \fCSLAVE_USER_FUNCTIONS\fP module (see \fBBuilding liblightmodbus\fP) 
.RE
.PP
\fBSee also:\fP
.RS 4
user-functions 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for liblightmodbus from the source code\&.
